<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@page isELIgnored="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
        <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title></title>
    <link href="${pageContext.request.contextPath}/static/assets/css/bootstrap.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/static/assets/css/font-awesome.css" rel="stylesheet" />
     <link rel="stylesheet" href="${pageContext.request.contextPath}/static/assets/css/profile.css">
     <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/laydate/laydate.js"></script>
    <link href="${pageContext.request.contextPath}/static/assets/css/custom-styles.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/static/assets/js/dataTables/dataTables.bootstrap.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/jquery-ui-timepicker-addon.css" >
    <script src="${pageContext.request.contextPath}/static/assets/js/jquery-1.10.2.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/jquery.metisMenu.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/dataTables/jquery.dataTables.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/dataTables/dataTables.bootstrap.js"></script>
     <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/jquery-ui-timepicker-addon.css" >
     <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/laydate/laydate.js"></script>
</head>
<body>
    <div id="wrapper">
        <div id="page-wrapper" >
          <div id="page-inner">
			 <div class="row">
                    <div class="col-md-12">
                        <h1 class="page-header">
                           Broadcast <small>details</small>
                        </h1>
                    </div>
              </div>  
            <div class="row">
              <div class="col-md-12">
                    <div class="col-sm-12">
                                
                                <div class="col-xs-12 col-sm-8 profile-name col-lg-7" >
                                  <h2>广播详情<span class="pull-right social-profile"> <em class="entypo-facebook-circled"></em> <em class="entypo-twitter-circled"></em> <em class="entypo-linkedin-circled"></em> <em class="entypo-github-circled"></em> <em class="entypo-gplus-circled"></em> </span> </h2>
                                  <hr>
						<form:form commandName="broadcast" method="post">
							<form:hidden path="id"/>
                                    <dl class="dl-horizontal-profile">
                                        <dt>用户编号</dt>
                                        <dd>${broadcast.userCode }</dd>

                                        <dt>广播内容</dt>
                                        <dd>${broadcast.broadcastContent }</dd>

                                        <dt>点赞数</dt>
                                        <dd><form:input path="fabulousCount" datatype="n"  nullmsg="点赞数必须为数字！" /></dd>
                                        
                                        <dt>阅读量</dt>
                                        <dd><form:input path="readCnt" datatype="n"  nullmsg="阅读 数必须为数字！" /></dd>
                                        
                                        <dt>评论数</dt>
                                        <dd>${broadcast.commentCount }</dd>
                                        
                                        <dt>发布时间</dt>
                                        <dd><form:input path="releaseTime" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" class="laydate-icon" datatype="*" nullmsg="发布时间不能为空!"/></dd>
                                        
                                        
                                        <dt>类型</dt>
                                        <dd>
                                        	<c:choose>
		                                    	<c:when test="${broadcast.type== 0 }">
		                                           	文字
		                                    	</c:when>
		                                    	<c:when test="${broadcast.type== 1 }">
		                                           	图片
		                                    	</c:when>
		                                    	<c:when test="${broadcast.type== 2 }">
		                                           	视频
		                                    	</c:when>
		                                    </c:choose>		                                  
		                                </dd>
                                        
                                        <dt>发布状态</dt>
								       	<dd>
								        			<form:select path="state">                    
<%-- 									                   	<form:option value="0" <c:out value="${broadcast.state == '0' ? 'selected' : ''} ">>正常</form:option>   --%>
<%-- 									                   	<form:option value="1" <c:out value="${broadcast.state == '1' ? 'selected' : ''} ">>禁用</form:option>   --%>
<%-- 									                   	<form:option value="2" <c:out value="${broadcast.state == '2' ? 'selected' : ''} ">>删除</form:option>   --%>
<%-- 									                   	<form:option value="3" <c:out value="${broadcast.state == '3' ? 'selected' : ''} ">>预发布</form:option>   --%>
									                   	<form:option value="0">正常</form:option>  
 									                   	<form:option value="1">禁用</form:option>
 									                   	<form:option value="2">删除</form:option>
 									                   	<form:option value="3">预发布</form:option>
								                 	</form:select>  	            
								       	</dd>
								       	
                                        <dt>图片</dt>
                                        <dd>
                                        	<div id="dd" style=" width:990px;">
                                        		<c:forEach items="${imgArr }" var="arr">
                                        			<img src="${arr } "  style="border:1px solid #ccc;margin-left:15px;width:42px;height:42px;"/> 
                                        		</c:forEach>
                                        	</div>
                                        </dd>
                                        
                                        <dt>视频地址</dt>
                                        <dd>${broadcast.broadcastVideo }</dd>
                                    </dl>
                                    <br />
                                    <br />
                                    <h4>评论列表:</h4>
                                    <table class="table table-striped table-bordered table-hover">
                                    	<thead>
                                    	<tr>
                                    		<td>评论人编号</td>                         		
                                    		<td>点赞数</td>
                                    		<td>评论内容</td>
                                    		<td>评论时间</td>
                                    		<td>状态</td>
                                    		<td>操作</td>
                                    	</tr>
                                    	</thead>
                                    	<tbody>
                                    	<c:forEach items="${recordLst }" var="record">
                                    		<tr>
                                    			<td>${record.sponsorCode }</td>
                                    			<td>${record.fabulousCount }</td>
	                                    		<td>${record.commentContent }</td>	                                    		
	                                    		<td><fmt:formatDate value="${record.commentTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
	                                    		<td>
	                                             	<c:choose>
	                                             		<c:when test="${record.state==0 }">
	                                             			正常
	                                             		</c:when>
	                                             		<c:when test="${record.state==1 }">
	                                             			禁用
	                                             		</c:when>			                                             					                                             	
	                                             		<c:when test="${record.state==2 }">
	                                             			删除
	                                             		</c:when>			                                             					                                             	
	                                               	</c:choose>
	                                            </td>
	                                    		<td>
	                                    		<shiro:hasPermission name="broadcast:disable">   
                       								<a href="${pageContext.request.contextPath}/broadcast/record/modify?broadcastId=${broadcast.id}&id=${record.id}">禁用</a>
                   							 	</shiro:hasPermission>
	                                    		</td>
                                    		</tr>
                                    	</tbody>
                                    	</c:forEach>
                                    </table>
                                    <table class="table table-bordered table-hover definewidth m10" style="margin-bottom:0" id="table1">		
									 	<tr> 		
								      
								        	<td>
								        		<input type="text" id="userCode1" name="userCode1" value="${broadcast.userCode }" style="height: 99px;border:0;" readonly="readonly"/>
								        	</td>
								        	<td>
								        		<input type="text" id="count" name="count" style="height: 99px;border:0;"/>
								        	</td>
								        	<td>
								      			<textarea class="commentContent" style="resize:none;border:0;height:99px" rows="45" cols="60" name="commentContent"></textarea>
								      		</td>
								        	
								      		<td>
								      			<input onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" style="border:0;height: 99px;" name="commentTime" type="text" >
								      		</td>
								      		<td>
								      			<input type="button" id="addTable" value="确认" style="font-weight:bold;font-size:30px;border:0;margin-top:25px;margin-left:40px;background:#fff"/> 
								      		</td>
								    	</tr>
						        		<div id="fl">
						        			<tr>
									        	<td>
									        		用户编号
									        	</td>
									        	<td>
									        		点赞数
									        	</td>
									        	<td>
									      			评论内容
									      		</td>
									        										      		
									      		<td>
									      			评论时间
									      		</td>
									      		<td>
									      			操作
									      		</td>
									    	</tr>
						        		</div>
					        		</table>
	                                    <dd><input type="submit" value="提交" onclick="sb()"></dd>
                                    </form:form>
                                     <hr>
                              </div>
   						</div>
   					</div>
 				</div>  
   			</div>
   		</div>
   </div>     
        <script>
            $(document).ready(function () {

                if($("#OrderStateId").val()=='1'){
                	$("#OrderStateId").attr("disabled", true);
                }
                if($("#OrderStateId").val()=='0'){
                	$("#OrderStateId").attr("disabled", false);
                }
            });
        /*     var str="${selectByPrimaryKey.videoUrl}";
            alert(str);
            	var newstr=str.substring(0,str.length-3)+"ogg";
            alert(newstr); */
          
            function sb() {
            	if (window.confirm("是否确认要提交?")) { 
            		// 确认时做的操作 
            		return true;
            	} else { 
            		// 取消时做的操作 
            		return false;
            	} 
            }
            
            $("#addTable").click(function(){
            	var code = $("input[name='userCode1']").val();
            	var count = $("input[name='count']").val();
            	var contents = $(".commentContent").val();
            	var time = $("input[name='commentTime']").val();
                var tr="<tr><td>"+code+"<input type='hidden' name='sponsorCode' value = '" + code + "'></td>"
                		+ "<td>"+count+"<input type='hidden' name='r_fabulousCount' value = '" + count + "'></td>"
                		+ "<td>"+contents+"<input type='hidden' name='commentContent' value = '" + contents + "'></td>"
                		+ "<td>"+time+"<input type='hidden' name='commentTime' value = '" + time + "'></td><td><a onclick=delete1(this) style='color:red;cursor:pointer'>"+"删除"+"</a></td></tr>";
                $("#table1").append(tr);
            });

            function delete1(obj){
            	$(obj).parent().parent().remove();
            }
    </script>
    <script src="${pageContext.request.contextPath}/static/assets/js/custom-scripts.js"></script>
</body>
</html>
